package cacheConsts

import "github.com/gogf/gf/v2/util/gconv"

// GetSysConfigKey 系统配置缓存建
func GetSysConfigKey(group string, configKey string) string {
	return "sysConf:" + group + ":" + configKey
}

// GetProductDeptConfigKey 部门产品配置缓存建
func GetProductDeptConfigKey(productId, deptId int64, group string, configKey string) string {
	return "prodDeptConf:" + gconv.String(productId) + ":" + gconv.String(deptId) + ":" + group + ":" + configKey
}

// GetDeptConfigKey 部门配置缓存建
func GetDeptConfigKey(deptId int64, group string, configKey string) string {
	return "deptConf:" + gconv.String(deptId) + ":" + group + ":" + configKey
}

// GetProductConfigKey 产品配置缓存建
func GetProductConfigKey(productId int64, group string, configKey string) string {
	return "prodConf:" + gconv.String(productId) + ":" + group + ":" + configKey
}

// GetUserConfigKey 用户配置缓存建
func GetUserConfigKey(userId int64, group string, configKey string) string {
	return "userConf:" + gconv.String(userId) + ":" + group + ":" + configKey
}

func GetUserInfo(userId int64, configKey string) string {
	return "userInfo:" + gconv.String(userId) + ":" + configKey
}

// GetDeviceGroupConfigKey 设备分组配置缓存建
func GetDeviceGroupConfigKey(deviceGroup int64, group string, configKey string) string {
	return "deGrpConf:" + gconv.String(deviceGroup) + ":" + group + ":" + configKey
}

// GetProductInfoKey 产品信息缓存建
func GetProductInfoKey(productId int64) string {
	return "productInfo:" + gconv.String(productId)
}

// GetDeviceInfoKey 设备信息缓存建
func GetDeviceInfoKey(deviceNo string) string {
	return "deviceInfo:" + gconv.String(deviceNo)
}

// GetDeviceConfigKey 设备配置缓存建
func GetDeviceConfigKey(deviceNo string, configKey string) string {
	return "deviceConf:" + gconv.String(deviceNo) + ":" + configKey
}

func GetDistributeTablesTimeGroupKey(dbConn, table string) string {
	return "distTiGrp:" + dbConn + ":" + table
}

// GetCacheAeDeviceTmpConfKey 设备临时配置的key
func GetCacheAeDeviceTmpConfKey(deviceNo string, dtype string) string {
	return "deviceTmp" + deviceNo + ":" + dtype
}

// GetDeviceDataKey 设备数据缓存建
func GetDeviceDataKey(deviceNo string, distributeTableFlag string, formatType string) string {
	return "deviceData:" + gconv.String(deviceNo) + ":" + distributeTableFlag + ":" + formatType
}
